home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 June: Reference Library / Dev.CD Jun 95 / Dev.CD Jun 95.toast / What's New? / New System Software Extensions / QuickDraw 3D ß / Programming / Interfaces / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-12  |  9.6 KB  |  352 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1995 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if PRAGMA_ONCE
  18.     #pragma once
  19. #endif
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22. #include <Quickdraw.h>
  23. #include <FixMath.h>
  24. #include <graphics types.h>
  25. #endif /* WINDOW_SYSTEM_MACINTOSH */
  26.  
  27. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  28. #include <X11/Xlib.h>
  29. #include <X11/Xutil.h>
  30. #endif /* WINDOW_SYSTEM_X11 */
  31.  
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif /*  __cplusplus  */
  35.  
  36.  
  37. /******************************************************************************
  38.  **                                                                             **
  39.  **                            DrawContext Data Structures                         **
  40.  **                                                                             **
  41.  *****************************************************************************/
  42.  
  43. typedef enum TQ3DrawContextClearImageMethod{
  44.     kQ3ClearMethodNone,
  45. #if defined(ESCHER_VER_15) && ESCHER_VER_15
  46.     kQ3ClearMethodWithColor,
  47.     kQ3ClearMethodWithShader
  48. #else
  49.     kQ3ClearMethodWithColor
  50. #endif /* ESCHER_VER_15 */
  51. } TQ3DrawContextClearImageMethod;
  52.  
  53.  
  54. typedef struct TQ3DrawContextData {
  55.     TQ3DrawContextClearImageMethod    clearImageMethod;
  56.     TQ3ColorARGB                    clearImageColor;
  57.     TQ3Area                            pane;
  58.     TQ3Boolean                        paneState;
  59.     TQ3Bitmap                        mask;
  60.     TQ3Boolean                        maskState;
  61.     TQ3Boolean                        doubleBufferState;
  62. } TQ3DrawContextData;
  63.  
  64.  
  65. /******************************************************************************
  66.  **                                                                             **
  67.  **                                DrawContext Routines                         **
  68.  **                                                                             **
  69.  *****************************************************************************/
  70.  
  71. EXPORT TQ3ObjectType Q3DrawContext_GetType(
  72.     TQ3DrawContextObject        drawContext);
  73.  
  74. EXPORT TQ3Status Q3DrawContext_SetData(
  75.     TQ3DrawContextObject        context,
  76.     const TQ3DrawContextData    *contextData);
  77.  
  78. EXPORT TQ3Status Q3DrawContext_GetData(
  79.     TQ3DrawContextObject        context,
  80.     TQ3DrawContextData            *contextData);
  81.     
  82. EXPORT TQ3Status Q3DrawContext_SetClearImageColor(
  83.     TQ3DrawContextObject        context,
  84.     const TQ3ColorARGB             *color);
  85.  
  86. EXPORT TQ3Status Q3DrawContext_GetClearImageColor(
  87.     TQ3DrawContextObject        context,
  88.     TQ3ColorARGB                 *color);
  89.  
  90. EXPORT TQ3Status Q3DrawContext_SetPane(
  91.     TQ3DrawContextObject        context,
  92.     const TQ3Area                 *pane);
  93.  
  94. EXPORT TQ3Status Q3DrawContext_GetPane(
  95.     TQ3DrawContextObject        context,
  96.     TQ3Area                         *pane);
  97.  
  98. EXPORT TQ3Status Q3DrawContext_SetPaneState(
  99.     TQ3DrawContextObject        context,
  100.     TQ3Boolean                    state);
  101.  
  102. EXPORT TQ3Status Q3DrawContext_GetPaneState(
  103.     TQ3DrawContextObject        context,
  104.     TQ3Boolean                    *state);
  105.         
  106. EXPORT TQ3Status Q3DrawContext_SetClearImageMethod(
  107.     TQ3DrawContextObject            context,
  108.     TQ3DrawContextClearImageMethod     method);
  109.         
  110. EXPORT TQ3Status Q3DrawContext_GetClearImageMethod(
  111.     TQ3DrawContextObject            context,
  112.     TQ3DrawContextClearImageMethod     *method);
  113.         
  114. EXPORT TQ3Status Q3DrawContext_SetMask(
  115.     TQ3DrawContextObject        context,
  116.     const TQ3Bitmap                *mask);
  117.         
  118. EXPORT TQ3Status Q3DrawContext_GetMask(
  119.     TQ3DrawContextObject        context,
  120.     TQ3Bitmap                    *mask);
  121.  
  122. EXPORT TQ3Status Q3DrawContext_SetMaskState(
  123.     TQ3DrawContextObject        context,
  124.     TQ3Boolean                    state);
  125.  
  126. EXPORT TQ3Status Q3DrawContext_GetMaskState(
  127.     TQ3DrawContextObject        context,
  128.     TQ3Boolean                    *state);
  129.  
  130. EXPORT TQ3Status Q3DrawContext_SetDoubleBufferState(
  131.     TQ3DrawContextObject        context,
  132.     TQ3Boolean                     state);
  133.  
  134. EXPORT TQ3Status Q3DrawContext_GetDoubleBufferState(
  135.     TQ3DrawContextObject        context,
  136.     TQ3Boolean                     *state);
  137.  
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **                            Pixmap Data Structure                             **
  142.  **                                                                             **
  143.  *****************************************************************************/
  144.  
  145. typedef struct TQ3PixmapDrawContextData {
  146.     TQ3DrawContextData        drawContextData;
  147.     TQ3Pixmap                pixmap;
  148. } TQ3PixmapDrawContextData;
  149.  
  150.  
  151. /******************************************************************************
  152.  **                                                                             **
  153.  **                        Pixmap DrawContext Routines                             **
  154.  **                                                                             **
  155.  *****************************************************************************/
  156.  
  157. EXPORT TQ3DrawContextObject Q3PixmapDrawContext_New(
  158.     const TQ3PixmapDrawContextData    *contextData);
  159.  
  160. EXPORT TQ3Status Q3PixmapDrawContext_SetPixmap(
  161.     TQ3DrawContextObject            drawContext,
  162.     const TQ3Pixmap                    *pixmap);
  163.  
  164. EXPORT TQ3Status Q3PixmapDrawContext_GetPixmap(
  165.     TQ3DrawContextObject            drawContext,
  166.     TQ3Pixmap                        *pixmap);
  167.  
  168. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  169.  
  170. /******************************************************************************
  171.  **                                                                             **
  172.  **                        Macintosh DrawContext Data Structures                 **
  173.  **                                                                             **
  174.  *****************************************************************************/
  175.  
  176. typedef enum TQ3MacDrawContext2DLibrary {
  177.     kQ3Mac2DLibraryNone,
  178.     kQ3Mac2DLibraryQuickDraw,
  179.     kQ3Mac2DLibraryQuickDrawGX
  180. } TQ3MacDrawContext2DLibrary;
  181.  
  182.  
  183. typedef struct TQ3MacDrawContextData {
  184.     TQ3DrawContextData            drawContextData;
  185.     CWindowPtr                    window;
  186.     TQ3MacDrawContext2DLibrary    library;
  187.     gxViewPort                    viewPort;
  188.     CGrafPtr                    grafPort;
  189. } TQ3MacDrawContextData;
  190.  
  191.  
  192. /******************************************************************************
  193.  **                                                                             **
  194.  **                        Macintosh DrawContext Routines                         **
  195.  **                                                                             **
  196.  *****************************************************************************/
  197.  
  198. EXPORT TQ3DrawContextObject Q3MacDrawContext_New(
  199.     const TQ3MacDrawContextData    *drawContextData);
  200.     
  201. EXPORT TQ3Status Q3MacDrawContext_SetWindow(
  202.     TQ3DrawContextObject        drawContext,
  203.     const CWindowPtr            window);
  204.  
  205. EXPORT TQ3Status Q3MacDrawContext_GetWindow(
  206.     TQ3DrawContextObject        drawContext,
  207.     CWindowPtr                    *window);
  208.  
  209. EXPORT TQ3Status Q3MacDrawContext_SetGXViewPort(
  210.     TQ3DrawContextObject        drawContext,
  211.     const gxViewPort            viewPort);
  212.  
  213. EXPORT TQ3Status Q3MacDrawContext_GetGXViewPort(
  214.     TQ3DrawContextObject        drawContext,
  215.     gxViewPort                    *viewPort);
  216.  
  217. EXPORT TQ3Status Q3MacDrawContext_SetGrafPort(
  218.     TQ3DrawContextObject        drawContext,
  219.     const CGrafPtr                grafPort);
  220.  
  221. EXPORT TQ3Status Q3MacDrawContext_GetGrafPort(
  222.     TQ3DrawContextObject        drawContext,
  223.     CGrafPtr                    *grafPort);
  224.  
  225. EXPORT TQ3Status Q3MacDrawContext_Set2DLibrary(
  226.     TQ3DrawContextObject        drawContext,
  227.     TQ3MacDrawContext2DLibrary    library);
  228.  
  229. EXPORT TQ3Status Q3MacDrawContext_Get2DLibrary(
  230.     TQ3DrawContextObject        drawContext,
  231.     TQ3MacDrawContext2DLibrary    *library);
  232.  
  233. #endif /* WINDOW_SYSTEM_MACINTOSH */
  234.  
  235. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  236.  
  237. /******************************************************************************
  238.  **                                                                             **
  239.  **                                Types                                         **
  240.  **                                                                             **
  241.  *****************************************************************************/
  242.  
  243. typedef struct TQ3XBufferData *TQ3XBufferObject;
  244.  
  245. typedef struct TQ3XColormapData {
  246.     long        baseEntry;
  247.     long        maxRed;
  248.     long        maxGreen;
  249.     long        maxBlue;
  250.     long        multRed;
  251.     long        multGreen;
  252.     long        multBlue;
  253. } TQ3XColormapData;
  254.  
  255.  
  256. typedef struct TQ3XDrawContextData {
  257.     TQ3DrawContextData        contextData;
  258.     Display                    *display;
  259.     Drawable                drawable;
  260.     Visual                    *visual;
  261.     Colormap                cmap;
  262.     TQ3XColormapData        *colorMapData;
  263. } TQ3XDrawContextData;
  264.  
  265.  
  266. /******************************************************************************
  267.  **                                                                             **
  268.  **                            XDrawContext Routines                             **
  269.  **                                                                             **
  270.  *****************************************************************************/
  271.  
  272. #ifdef XDC_OLD
  273. EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  274.     void);
  275.  
  276. EXPORT void Q3XDrawContext_Set(
  277.     TQ3DrawContextObject        drawContext,
  278.     unsigned long            flag,                             
  279.     void                    *data);
  280.  
  281. EXPORT void Q3XDrawContext_Get(
  282.     TQ3DrawContextObject        drawContext,
  283.     unsigned long            flag,                             
  284.     void                    *data);
  285. #endif  /* XDC_OLD */
  286.  
  287. EXPORT TQ3XBufferObject Q3XBuffers_New(
  288.     Display                    *dpy,                       
  289.     unsigned long            numBuffers,
  290.     Window                    window);
  291.  
  292. EXPORT void Q3XBuffers_Swap(
  293.     Display                    *dpy,
  294.     TQ3XBufferObject            buffers);
  295.  
  296. EXPORT XVisualInfo *Q3X_GetVisualInfo(
  297.     Display                    *dpy,
  298.     Screen                    *screen);
  299.  
  300.  
  301. EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  302.     const TQ3XDrawContextData    *xContextData);
  303.  
  304. EXPORT TQ3Status Q3XDrawContext_SetDisplay(
  305.     TQ3DrawContextObject        drawContext,
  306.     const Display                *display);
  307.  
  308. EXPORT TQ3Status Q3XDrawContext_GetDisplay(
  309.     TQ3DrawContextObject        drawContext,
  310.     Display                        **display);
  311.  
  312. EXPORT TQ3Status Q3XDrawContext_SetDrawable(
  313.     TQ3DrawContextObject        drawContext,
  314.     Drawable                    drawable);
  315.  
  316. EXPORT TQ3Status Q3XDrawContext_GetDrawable(
  317.     TQ3DrawContextObject        drawContext,
  318.     Drawable                    *drawable);
  319.  
  320. EXPORT TQ3Status Q3XDrawContext_SetVisual(
  321.     TQ3DrawContextObject        drawContext,
  322.     const Visual                *visual);
  323.  
  324. EXPORT TQ3Status Q3XDrawContext_GetVisual(
  325.     TQ3DrawContextObject        drawContext,
  326.     Visual                        **visual);
  327.  
  328. EXPORT TQ3Status Q3XDrawContext_SetColormap(
  329.     TQ3DrawContextObject        drawContext,
  330.     Colormap                    colormap);
  331.  
  332. EXPORT TQ3Status Q3XDrawContext_GetColormap(
  333.     TQ3DrawContextObject        drawContext,
  334.     Colormap                    *colormap);
  335.  
  336. EXPORT TQ3Status Q3XDrawContext_SetColormapData(
  337.     TQ3DrawContextObject        drawContext,
  338.     const TQ3XColormapData        *colormapData);
  339.  
  340. EXPORT TQ3Status Q3XDrawContext_GetColormapData(
  341.     TQ3DrawContextObject        drawContext,
  342.     TQ3XColormapData            *colormapData);
  343.  
  344. #endif /* WINDOW_SYSTEM_X11 */
  345.  
  346.  
  347. #ifdef __cplusplus
  348. }
  349. #endif /*  __cplusplus  */
  350.  
  351. #endif  /*  QD3DDrawContext_h  */
  352.